# coding:utf-8
from multiprocessing import Process, Manager
import os


class TestProcess(Process):
    data = None;

    def __init__(self, data):
        Process.__init__(self)
        self.data = data
    
    def run(self):
        print("子进程,TestProcess,pid=%d,ppid=%d,a=%s" % (os.getpid(), os.getppid(), self.data["a"]))
        self.data["a"] = "456"


def main():
    with Manager() as manager:
        print("主进程,pid=%d" % (os.getpid()))
        data = manager.dict()
        data["a"] = "123"
        process = TestProcess(data)
        process.start()
        process.join()
        print("主进程结束!,name=%s" % (data["a"]))

    
if __name__ == "__main__":
    main()
